<html>
<script>
    if (window.testRunner)
        testRunner.dumpAsText();
</script>
<body id='body'>


    <!-- This test makes sure that these types of elements DO NOT have children.
         The test will pass if attributesOfChildren() returns nil -->

    <input id="file" type="file">
    <div id="button" role="button">inside</div>
    <div id="button-w-popup" role="button" aria-haspopup="true">inside</div>

    <div id="button-2" role="button"><b><i>inside</i></b></div>
    <div id="button-w-popup-2" role="button" aria-haspopup="true"><b><i>inside</i></b></div>

    <div id="result"></div>


    <script>
      function allChildrenAreIgnored(element) {
        for(let i = 0; i < element.childCount; ++i) {
          if (!element.childAtIndex(i).isIgnored)
            return false;
        }
        return true;
      }

        if (window.accessibilityController) {
            var result = document.getElementById("result");

            var element1 = accessibilityController.accessibleElementById("file");
            var element2 = accessibilityController.accessibleElementById("button");
            var element3 = accessibilityController.accessibleElementById("button-w-popup");
            var element4 = accessibilityController.accessibleElementById("button-2");
            var element5 = accessibilityController.accessibleElementById("button-w-popup-2");

            var element1Children = element1.attributesOfChildren();
            var element2Children = element2.attributesOfChildren();
            var element3Children = element3.attributesOfChildren();
            var element4Children = element4.attributesOfChildren();
            var element5Children = element5.attributesOfChildren();

            result.innerText += allChildrenAreIgnored(element1) ? "PASS" : "FAIL#1 " + element1Children;
            result.innerText += "\n";

            result.innerText += allChildrenAreIgnored(element2) ? "PASS" : "FAIL#2 " + element2Children;
            result.innerText += "\n";

            result.innerText += allChildrenAreIgnored(element3) ? "PASS" : "FAIL#3 " + element3Children;
            result.innerText += "\n";

            result.innerText += allChildrenAreIgnored(element4) ? "PASS" : "FAIL#4 " + element4Children;
            result.innerText += "\n";

            result.innerText += allChildrenAreIgnored(element5) ? "PASS" : "FAIL#5 " + element5Children;
            result.innerText += "\n";
        }
    </script>
</body>
</html>
